package com.h52mm.mybatis.demo.mapper;

import com.h52mm.mybatis.demo.model.Order;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface OrderZjMapper {

    @Results({
            @Result(property = "id",column = "id"),
            @Result(property = "orderTime",column = "order_time"),
            @Result(property = "user" ,column = "uid" ,one = @One(select = "com.h52mm.mybatis.demo.mapper.UserZjMapper.selectUserById"))
    })
    @Select("select *from t_order")
    public List<Order> selectOrderList();

    @Select("select id,order_time orderTime from t_order where uid=#{uid}")
    public List<Order> selectOrdersByUid(Integer uid);
}
